%GLOBAL CWD; %LET CWD = %SUBSTR(%SYSGET(SAS_EXECFILEPATH), 1, %EVAL(%LENGTH(%SYSGET(SAS_EXECFILEPATH)) - %LENGTH(%SYSGET(SAS_EXECFILENAME)) - 1));
%INCLUDE "&CWD\TOOLS.SAS";

/* SET ELI & CLUSTER */
%LET ELI = FL021;
%LET CLUSTER = 01A;

/* IDENTIFYING HANDLE */
%LET COM = &ELI._&CLUSTER.;

/* ITEM-SPECIFIC RIGHT HAND SIDE VARIABLES */
%LET RHS= 
    G2 G3 H3 J3 
    MNAMT MNAMTSQ
    ;

%LET STYR=0201;
%LET FIRSTPER=20&STYR;
%LET LASTPER = 200709;
%LET STDUM=D&STYR;
%LET RHYRS= 
        D0202--D0709;
%LET NSPER=69;
%LET NVEC=75;

/* DEFINE ITEM-SPECIFIC PRICE EDITS */
%MACRO EDITS;
    IF ELI="FL021" AND A="A1";
    IF CLUSTER="01A";
    IF B="";
    IF PRICE GE .01;
    IF PRICE LE .15;
    *;
    IF LNAMT LE 4.86;
    IF LNAMT GE 1;
%MEND;

/* DEFINE ITEM-SPECIFIC DUMMIES */
%MACRO VARS;
    J3=(J="J3"); 
    ARRAY SPECARRAY (3) G H J ;
    DO COUNT=1 TO 3;
        IF SPECARRAY(COUNT)="" THEN DELETE;
    END;
%MEND;

LIBNAME IN "&CWD\DATA";
LIBNAME OUT "&CWD\DATA";

FILENAME OUTLOGS "&CWD\OUTPUT\LOGINDEXES.XLS";
FILENAME OUTCONTS "&CWD\OUTPUT\LOGCONTRIBS.XLS";
FILENAME OUTDISCS "&CWD\OUTPUT\DISCOUNTS.XLS";
FILENAME OUTPCTLS "&CWD\OUTPUT\PCTLS.XLS";

%INCLUDE "&CWD\TABLESTOBUILD.SAS";
